package com.apes.framework.plugin.scheduler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


/**
 * 功能：Schedule初始化
 *
 * @author xul
 * @create 2018-03-29 13:41
 */
@Component
@Order(value = 100)
public class ScheduleInitRunner implements CommandLineRunner {

    @Autowired
    TaskService taskService;

    @Override
    public void run(String... strings) throws Exception {

//        if(!taskService.exists("task.scheduler")) {
//            Task task = new Task();
//            task.setId("task.scheduler");
//            task.setDescription("获取任务列表");
//            task.setMethod("schedule.task.run");
//            task.setCronExpression("0 */10 * * * *");
//            taskService.save(task);
//        }
//
//        if(!taskService.exists("mq.scheduler")) {
//            Task task = new Task();
//            task.setId("mq.scheduler");
//            task.setDescription("MQ异常消息处理");
//            task.setMethod("schedule.mq.run");
//            task.setCronExpression("0 */1 * * * *");
//            taskService.save(task);
//        }
    }


}
